import 'package:flutter/material.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBEngineer/YBBaseRouter/YBNavigator.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBColor/YBColor.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBTextStyle/YBTextStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/yb_chinese_text/yb_chinese_text.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBModule/YBMineModule/YBQiYePersonPage/YBNumberManagerProvider/YBQiYeAndPersonManagerEventBus.dart';

class YBQiYeAndPersonInputPage extends StatefulWidget {

  final String titleHeader;
  final String contentStr;

  const YBQiYeAndPersonInputPage({Key key, this.titleHeader, this.contentStr}) : super(key: key);

  @override
  _YBQiYeAndPersonInputPageState createState() => _YBQiYeAndPersonInputPageState(titleHeader: titleHeader,contentStr: contentStr);
}

class _YBQiYeAndPersonInputPageState extends State<YBQiYeAndPersonInputPage> {

  final String titleHeader;
  final String contentStr;

  _YBQiYeAndPersonInputPageState({this.titleHeader, this.contentStr});

  TextEditingController _editingController = TextEditingController();

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _editingController.text = contentStr != null?contentStr:null;
  }

  @override
  void dispose() {
    // TODO: implement dispose
    _editingController.dispose();
    super.dispose();
  }


  @override
  Widget build(BuildContext context) {
    return Container(
      child: Scaffold(
        appBar: AppBar(
          title: Text(titleHeader,style: YBTextStyle.TextStyle30313320Medium),
          elevation: 0,
          actions: [
            Container(
              child: InkWell(
                child: Container(
                  alignment: Alignment.center,
                  child: Padding(
                    padding:EdgeInsets.only(right: YBTextStyle.adapterSize10),
                    child: Text(
                      YBChineseText.mineCompleteTitle,
                      style: YBTextStyle.TextStyle30313312,
                    ),
                  ),
                ),
                onTap: () async {
                  qiYeAndPersonManagerEventBus.fire(YBQiYeAndPersonManagerEventBus(title: titleHeader,content: _editingController.text));
                  YBNavigatorUtil.goDefaultBack(context);
                },
              ),
            ),
          ],
        ),
        body: SingleChildScrollView(
          child: Column(
            children: [
              Container(
                height: YBTextStyle.adapterSize10,
              ),
              Container(
                height: YBTextStyle.adapterSize45,
                color: YBColor.white,
                child: Padding(
                  padding: EdgeInsets.only(left: YBTextStyle.adapterSize20,right: YBTextStyle.adapterSize20),
                  child: TextField(
                    decoration: InputDecoration(
                      hintText: '${YBChineseText.mineQingInputTitle}$titleHeader',
                      border: InputBorder.none,
                    ),
                    controller: _editingController,
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
